import { Cache } from "../../../cache/Cache";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { SEntityId } from "../../../../../Message/Public/SEntityId";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
type int = number;
//class KingChampionShipUtil
    
    export  class KingChampionShipUtil
    {
        

        public static isMyGuild(arg1: int, arg2: int, arg3: int): Boolean
        {
            var loc1;
            if ((loc1 = Cache.instance.role.entityInfo.guildId) > 0) 
            {
                return EntityUtil.isSameServerByProxyAndServer(arg1, arg2) && loc1 == arg3;
            }
            return false;
        }

        public static isMyGuildByEntityId(arg1: SEntityId): Boolean
        {
            var loc1=Cache.instance.role.entityInfo.guildId;
            if (loc1 > 0) 
            {
                return EntityUtil.isSameServerByRole(arg1) && loc1 == arg1.id;
            }
            return false;
        }

        public static getForceName(arg1: int, arg2: Boolean=true, arg3: Boolean=true): string
        {
            var loc2=null;
            var loc3=null;
            var loc1;
            if ((loc1 = Cache.instance.kingChampionShip.forceInfo) && loc1.robCityTwoJoinTeams && loc1.robCityTwoJoinTeams.length > 0) 
            {
                loc2 = "";
                var loc4=0;
                var loc5=loc1.robCityTwoJoinTeams;
                for(loc3 of loc5) 
                {
                    if (loc3.froce != arg1) 
                    {
                        continue;
                    }
                    if (arg3) 
                    {
                        loc2 = KingChampionShipUtil.getForceColor(loc3.froce, false);
                        if (arg2) 
                        {
                            return HTMLUtil.addColor(loc3.guildName, loc2);
                        }
                        return HTMLUtil.addColor(loc3.guildName, loc2);
                        continue;
                    }
                    if (arg2) 
                    {
                        return loc3.guildName;
                    }
                    return loc3.guildName;
                }
            }
            return "";
        }

        public static getForceColor(arg1: int, arg2: Boolean)
        {
            if (arg1 == Cache.instance.role.entityInfo.force) 
            {
                return arg2 ? GlobalStyle.color5Uint : GlobalStyle.color5;
            }
            return arg2 ? GlobalStyle.color7Uint : GlobalStyle.color7;
        }

        public static getKillScroe(arg1: int): int
        {
            if (arg1 >= 200) 
            {
                return 250;
            }
            if (arg1 > 50) 
            {
                return 50 + arg1;
            }
            return 2 * arg1;
        }

        public static getGuildScore(arg1: int): int
        {
            return int(arg1 / 20 + 200);
        }
    }
